<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        border: 3px solid;
        padding: 10px;
        background-color: white;
      }
      div > b:hover {
        cursor: pointer;
        background-color: yellow;
      }
    </style>
  </head>
  <body>
    <div id="box1">
      <b>box1</b>
      <div id="box2">
        <b>box2</b>
        <div id="box3"><b>box3</b></div>
      </div>
    </div>
    <script>
      window.addEventListener(
        "click",
        () => {
          console.log("window");
        },
        true
      );
      document.addEventListener(
        "click",
        () => {
          console.log("document");
        },
        true
      );

      document.documentElement.addEventListener(
        "click",
        () => {
          console.log("html");
        },
        true
      );

      document.body.addEventListener(
        "click",
        () => {
          console.log("body");
        },
        true
      );

      box1.addEventListener(
        "click",
        (e) => {
          console.log(1);
        },
        true
      );
      box2.addEventListener(
        "click",
        (e) => {
          console.log(2);
        },
        true
      );
      box3.addEventListener(
        "click",
        (e) => {
          console.log(3);
        },
        true
      );

      // ----------

      window.addEventListener("click", () => {
        console.log("window");
      });
      document.addEventListener("click", () => {
        console.log("document");
      });

      document.documentElement.addEventListener("click", () => {
        console.log("html");
      });

      document.body.addEventListener("click", () => {
        console.log("body");
      });

      box1.addEventListener("click", (e) => {
        console.log(1);
      });
      box2.addEventListener("click", (e) => {
        console.log(2);
      });
      box3.addEventListener("click", (e) => {
        console.log(3);
      });
    </script>
  </body>
</html>
